Skip to content

Fix output only json if using json output for ephemeral environment deprovisioning commands#566

Merged
stevencl840 merged 3 commits intomainfrom
sjc/ee-deprov-json-only
Nov 13, 2025
Merged

Fix output only json if using json output for ephemeral environment deprovisioning commands#566
stevencl840 merged 3 commits intomainfrom
sjc/ee-deprov-json-only

Conversation

@stevencl840
Copy link
Copy Markdown
Contributor

@stevencl840 stevencl840 commented Nov 13, 2025

Context 🌆

Ephemeral environments are temporary environments that developers can use to test changes. They are expected to come and go with the same cadence as a PR, created when the PR is opened and torn down when it is merged.

Users need to be able to deprovision a specific project in an ephemeral environment.

Details 🔍

We added some messages to our output to show the user what is happening with the deprovisioning command. These messages will mean that the user will not be able to parse the json output. I have removed these messages when the user has selected json output.

I have also updated the two commands to output automation commands.

After

chrome_uyOzPdVEp2 WindowsTerminal_4FUienytyu chrome_pGzv4ImaG1

@stevencl840 stevencl840 requested a review from Copilot November 13, 2025 04:11
@stevencl840 stevencl840 changed the title Modify code to only output json if using json output for ephemeral environment deprovisioning commands Fix output only json if using json output for ephemeral environment deprovisioning commands Nov 13, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR modifies the deprovisioning commands to only output status messages when using non-JSON output formats. Previously, messages were printed before calling the output function, which would interfere with JSON output. Now the message is passed as a parameter and conditionally printed based on the output format.

Key changes:

  • Modified OutputDeprovisionResult to accept a message parameter
  • Message is now printed only for basic and table (default) output formats, not for json

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
pkg/cmd/ephemeralenvironment/util/util.go Added message parameter to OutputDeprovisionResult and conditionally prints it only for non-JSON output formats
pkg/cmd/ephemeralenvironment/deprovision-project/deprovision_project.go Removed direct message printing and now passes the message to OutputDeprovisionResult for conditional output
pkg/cmd/ephemeralenvironment/deprovision-environment/deprovision_environment.go Removed direct message printing and now passes the message to OutputDeprovisionResult for conditional output

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/cmd/ephemeralenvironment/deprovision-project/deprovision_project.go Outdated
@stevencl840 stevencl840 marked this pull request as ready for review November 13, 2025 04:50
Copy link
Copy Markdown
Contributor

@lourens-octopus lourens-octopus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@stevencl840 stevencl840 merged commit af34422 into main Nov 13, 2025
4 checks passed
@stevencl840 stevencl840 deleted the sjc/ee-deprov-json-only branch November 13, 2025 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants